﻿using System;
using System.Data;
using System.Data.DBLib;


namespace SysOperationLayer.DBHandle
{
    public class ReminderDB : DBBase
    {
        public DataTable getReminderSp(int userId, int alertDay)
        {
            if (ConnectDB())
            {
                DataSet ds;
                CDBError objError = new CDBError();
                m_objDB.prepareStatement("OptGetReminderSp");
                m_objDB.addParameter("UserId", userId);
                m_objDB.addParameter("AdvanceAlertDay", alertDay);
 
                ds = m_objDB.executeQueryStatement(objError);

                if (ds != null && ds.Tables.Count > 0)
                {
                    return ds.Tables[0];
                }
            }
            else
            {
                m_strMessage = "Cannot Connect to the Database!";
            }
            return null;
        }

        public DataTable getReminderSp2(string LoginName)
        {
            if (ConnectDB())
            {
                DataSet ds;
                CDBError objError = new CDBError();
                m_objDB.prepareStatement("OptGetReminder2Sp");
                m_objDB.addParameter("UserName", LoginName);

                ds = m_objDB.executeQueryStatement(objError);

                if (ds != null && ds.Tables.Count > 0)
                {
                    return ds.Tables[0];
                }
            }
            else
            {
                m_strMessage = "Cannot Connect to the Database!";
            }
            return null;
        }
    }
}
